<?php
class AdminSupplierEntityBase extends EntityBase
{
	public $id;	
	public $supplier_name;
	public $supplier_address;
	public $phone;
	public $website;
	public $logo;

	
	const INACTIVE = 0;
	const ACTIVE = 1;

	public function __construct($arrValue = null, $prefix = '')
	{
		if (!is_null($arrValue) && is_array($arrValue))
		{
			$this->id = (int) ($arrValue[$prefix . 'id']);
			$this->supplier_name = strval ($arrValue[$prefix . 'supplier_name']);
			$this->supplier_address = strval ($arrValue[$prefix . 'supplier_address']);
			$this->phone = strval ($arrValue[$prefix . 'phone']);
			$this->website = strval ($arrValue[$prefix . 'website']);
			$this->logo = strval ($arrValue[$prefix . 'logo']);
		}
	}

	/**
	 * Get status name of page
	 *
	 * @access public
	 *
	 * @return string name of status
	 *
	 */
	public function getStatusName()
	{
		if (is_null($this->status)){
			return '';
		}
		if ($this->status == self::INACTIVE){
			return 'Inactive';
		}else if($this->status == self::ACTIVE){
			return 'Active';
		}

		// Return empty string
		return '';
	}
	
	/**
	 * Get list of page status
	 *
	 * @access public
	 *
	 * @return array of gallery status
	 *
	 */
	public static function getStatusList()
	{
		return array(self::INACTIVE	=> 'Inactive',
    				self::ACTIVE 	=>'Active'
    				);
	}
	
	
	/**
	 * Get all fields for selecting columns
	 *
	 * @param string $alias: alias of table
	 * @param string $prefix
	 * @return string
	 */
	public static function getSelectColumns($alias, $prefix = '')
	{
		
		$arrValue = array(
						"{$alias}.id AS `{$prefix}id`",
						"{$alias}.supplier_name AS `{$prefix}supplier_name`",
						"{$alias}.supplier_address AS `{$prefix}supplier_address`",
						"{$alias}.phone AS `{$prefix}phone`",
						"{$alias}.website AS `{$prefix}website`",
						"{$alias}.logo AS `{$prefix}logo`"
						);

		return implode(',', $arrValue);
	}
}